OBJS = boot.bin setup.bin 

all: boot.img 

%.bin: %.S
	gcc -E $*.S -I../include/ > $*.s 
	as --64 $*.s -o $*.o.l
	ld $*.o.l -o $*.o -T boot.lds 
	objcopy -I elf32-i386 -S -j .text -O binary $*.o $*.bin 


Image: $(OBJS) ../init/rawkbin 
	dd if=/dev/zero of=Image bs=1048576 count=64 
	dd if=boot.bin of=Image conv=notrunc 
	dd if=setup.bin of=Image conv=notrunc bs=512 seek=1 
	dd if=../init/rawkbin of=Image bs=512 conv=notrunc seek=3 


.PHONY clean: 
	rm $(OBJS) -f *.o.l *.o *.s 


